-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[DI] Automatically applying a tag to all services implementing an int… #7983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
What about adding this as a tip instead, and using the .. tip::
To apply a tag to all your autoconfigured services extending a class or an
interface, call ``ContainerBuilder::registerForAutoconfiguration()`` in an
:doc:`extension </bundles/extension>` or from your kernel::
// app/AppKernel.php
class AppKernel extends Kernel
{
// ...
protected function build(ContainerBuilder $container)
{
$container->registerForAutoconfiguration(CustomInterface::class)
->addTag('app.custom_tag')
;
}
} |
Even better. Updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍, thanks for your first contribution!
service_container/tags.rst
Outdated
.. tip:: | ||
|
||
To apply a tag to all your autoconfigured services extending a class or an | ||
interface, call ``ContainerBuilder::registerForAutoconfiguration()`` in an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can even use the method
role here to create a link to the API docs:
[...] :method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::registerForAutoconfiguration` [...]
Updated, thanks @xabbuh |
Awesome! Thank you Daniel! |
…menting an int… (danut007ro) This PR was squashed before being merged into the 3.3 branch (closes #7983). Discussion ---------- [DI] Automatically applying a tag to all services implementing an int… …erface Commits ------- c31e24c Create tags.rst e5b1758 Update tags.rst cb545ff [DI] Automatically applying a tag to all services implementing an interface
…erface